<template>
  <div>{{ store.count }}</div>
  <button @click="store.count++">+</button><br />
  <button @click="store.increment(2)">调用方法increment加2</button>
  <div>getter: {{ store.double }}</div>
  <button @click="increment(2)">解构increment方法</button>
</template>

<script setup>
import { inject } from "vue";
import { useStore } from "./store";
import { PiniaSymbol } from "./pinia/rootState";
// debugger
const store = useStore();

// 解构方法
const { increment } = store;
console.log("store---------", store);
console.log("pinia---------", inject(PiniaSymbol));

store.$subscribe((state) => {
  console.log("subscribe", state.count);
});
</script>

<style scoped lang="less"></style>
